Unified address translation for virtualization of input/output devices

ABSTRACT

Embodiments of apparatuses, methods, and systems for unified address translation for virtualization of input/output devices are described. In an embodiment, an apparatus includes first circuitry to use at least an identifier of a device to locate a context entry and second circuitry to use at least a process address space identifier (PASID) to locate a PASID-entry. The context entry is to include at least one of a page-table pointer to a page-table translation structure and a PASID. The PASID-entry is to include at least one of a first-level page-table pointer to a first-level translation structure and a second-level page-table pointer to a second-level translation structure. The PASID is to be supplied by the device. At least one of the apparatus, the context entry, and the PASID entry is to include one or more control fields to indicate whether the first-level page-table pointer or the second-level page-table pointer is to be used.

FIELD OF INVENTION

The field of invention relates generally to computer architecture, and,more specifically, but without limitation, to virtualization in computersystems.

BACKGROUND

Computers and other information processing systems may include one ormore subsystems or components, such as input/output (I/O) devices, thatmay independently access a system memory, for example, using directmemory access (DMA) transactions and/or be accessed by one or moreprocessors. Various system capabilities, such as virtualization, mayresult in different views of system memory for different I/O devices.Therefore, various address translation techniques for virtualization ofI/O devices have been developed.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention is illustrated by way of example and notlimitation in the figures of the accompanying drawings, in which likereferences indicate similar elements and in which:

FIG. 1 is a block diagram illustrating a root complex in a systemaccording to an embodiment of the invention;

FIG. 2 is a block diagram illustrating an input/output memory managementunit (IOMMU) according to an embodiment of the invention;

FIGS. 3 and 4 are block diagrams illustrating IOMMU architecturesaccording to embodiments of the invention;

FIG. 5A is a flow diagram illustrating a method of process address spaceidentifier (PASID) management according to an embodiment of theinvention;

FIG. 5B is a block diagram illustrating an IOMMU architecture for PASIDmanagement according to an embodiment of the invention;

FIG. 6A is a flow diagram illustrating a method of PASID managementaccording to an embodiment of the invention;

FIG. 6B is a block diagram illustrating an IOMMU architecture for PASIDmanagement according to an embodiment of the invention;

FIGS. 7A and 7B are flow diagrams illustrating software-based approachesto I/O virtual address (IOVA) virtualization according to embodiments ofthe invention;

FIG. 8 is a block diagram illustrating a hardware-based approach to IOVAvirtualization according to an embodiment of the invention;

FIG. 9A is a block diagram illustrating both an exemplary in-orderpipeline and an exemplary register renaming, out-of-orderissue/execution pipeline according to embodiments of the invention;

FIG. 9B is a block diagram illustrating both an exemplary embodiment ofan in-order architecture core and an exemplary register renaming,out-of-order issue/execution architecture core to be included in aprocessor according to embodiments of the invention;

FIG. 10 is a block diagram of a processor that may have more than onecore, may have an integrated memory controller, and may have integratedgraphics according to embodiments of the invention;

FIG. 11 is a block diagram of a system in accordance with one embodimentof the present invention;

FIG. 12 is a block diagram of a first more specific exemplary system inaccordance with an embodiment of the present invention;

FIG. 13 is a block diagram of a second more specific exemplary system inaccordance with an embodiment of the present invention; and

FIG. 14 is a block diagram of a SoC in accordance with an embodiment ofthe present invention.

DETAILED DESCRIPTION

In the following description, numerous specific details, such ascomponent and system configurations, may be set forth in order toprovide a more thorough understanding of the present invention. It willbe appreciated, however, by one skilled in the art, that the inventionmay be practiced without such specific details. Additionally, somewell-known structures, circuits, and other features have not been shownin detail, to avoid unnecessarily obscuring the present invention.

References to “one embodiment,” “an embodiment,” “example embodiment,”“various embodiments,” etc., indicate that the embodiment(s) of theinvention so described may include particular features, structures, orcharacteristics, but more than one embodiment may and not everyembodiment necessarily does include the particular features, structures,or characteristics. Some embodiments may have some, all, or none of thefeatures described for other embodiments. Moreover, such phrases are notnecessarily referring to the same embodiment. When a particular feature,structure, or characteristic is described in connection with anembodiment, it is submitted that it is within the knowledge of oneskilled in the art to effect such feature, structure, or characteristicin connection with other embodiments whether or not explicitlydescribed.

As used in this description and the claims and unless otherwisespecified, the use of the ordinal adjectives “first,” “second,” “third,”etc. to describe an element merely indicate that a particular instanceof an element or different instances of like elements are being referredto, and is not intended to imply that the elements so described must bein a particular sequence, either temporally, spatially, in ranking, orin any other manner.

Also, as used in descriptions of embodiments of the invention, a “/”character between terms may mean that an embodiment may include or beimplemented using, with, and/or according to the first term and/or thesecond term (and/or any other additional terms).

Various techniques, for example, single-root I/O virtualization(SR-IOV), as defined by the Peripheral Component Interconnect Express(PCIe) specification, and scalable I/O virtualization (Scalable IOV), asdescribed below, may provide for virtualization of I/O devices. A systemmay include hardware, such as an I/O memory management unit (IOMMU) toperform address translation and/or remapping to support transactionsbetween various I/O devices, system memory, and processors. The use ofembodiments of the invention may be desired to provide a unifiedapproach to address translation for virtualization of I/O devices, forexample, to support various virtualization and/or remapping techniquesusing a single IOMMU.

FIG. 1 is a block diagram illustrating a root complex or other deviceincluding or serving as a bridge between one or more I/O devices andsystem memory according to an embodiment of the invention. Root complex100 in FIG. 1 may be implemented in logic gates, storage elements, andany other type of circuitry, all or parts of which may be included in adiscrete component and/or integrated into the circuitry of a processingdevice or any other apparatus in a computer or other informationprocessing system. In FIG. 1 , root complex 100 is shown within system102. Also, FIGS. 9 through 14 show processors and systems that mayinclude embodiments of the invention. For example, root complex 100and/or any or all the elements shown in root complex 100 may berepresented by or included in controller hub 1120, chipset 1290, or DMAunit 1432, each as described below.

Root complex 100 may represent any circuitry or component, such as achipset component, including or through which I/O, peripheral, and/orother components or devices, such as touchscreens, keyboards,microphones, speakers, other audio devices, cameras, video or othermedia devices, motion or other sensors, receivers for global positioningor other information, network interface controllers, compute or otheraccelerators, and/or information storage devices, may be connected orcoupled to a processor, a memory controller, a system memory, and/or anytype of processor/memory subsystem.

System 102 and any other system embodying the invention may include anynumber of each of these components and any other components or otherelements. Any or all of the components or other elements in this or anysystem embodiment may be connected, coupled, or otherwise incommunication with each other through any number of buses,point-to-point, or other wired or wireless interfaces or interconnects,unless specified otherwise. Any components or other portions of system102, whether shown in FIG. 1 or not shown in FIG. 1 , may be integratedor otherwise included on or in a single chip (a system-on-a-chip orSOC), die, substrate, or package.

System memory 142 may be dynamic random access memory (DRAM) or anyother type of medium readable by processor 144. System memory 142 may beused to provide a physical memory space from which to abstract a systemmemory space for system 102. The content of system memory space, atvarious times during the operation of system 102, may include variouscombinations of data, instructions, code, programs, software, and/orother information stored in system memory 142 and/or moved from, movedto, copied from, copied to, and/or otherwise stored in various memories,storage devices, and/or other storage locations (e.g., processor cachesand registers) in system 102. Memory controller 140 may represent anycircuitry or component for accessing, maintaining, and/or otherwisecontrolling system memory 142.

The system memory space may be logically organized, addressable as,and/or otherwise partitioned (e.g., using any known memory management,virtualization, partitioning, and or other techniques) into regions ofone or more sizes. In various embodiments, such regions may include4K-byte pages, so, for convenience, such regions may be referred to inthis description as pages; however, the use of the term “page” in thisdescription may mean any size region of memory.

Processor 144 may represent all or part of a hardware componentincluding one or more processors or processor cores integrated on asingle substrate or packaged within a single package, each of which mayinclude multiple execution threads and/or multiple execution cores, inany combination. Each processor represented as or in processor 144 maybe any type of processor, including a general purpose microprocessor,such as a processor in the Intel® Core® Processor Family or otherprocessor family from Intel® Corporation or another company, a specialpurpose processor or microcontroller, or any other device or componentin an information processing system in which an embodiment of thepresent invention may be implemented. Processor 144 may be architectedand designed to operate according to any instruction set architecture(ISA).

Nonvolatile memory 146 may be any type of nonvolatile memory and may beused to store any code, data, or information to be maintained duringvarious power states and through various power cycles of system 102. Forexample, nonvolatile memory 146 may be used to store basic input/outputsystem (BIOS) or other code that may be used for booting, restarting,and/or resetting system 102 or any portion of system 102.

Root complex 100 includes bridge 104, which may include any circuitry,other hardware, or firmware to connect a memory side (e.g., a subsystemincluding system memory 142) of system 102 to an I/O side (e.g., asubsystem including I/O devices 132, 134, and 136) of system 102, and/orto deliver, forward, translate, associate, and/or otherwise bridgetransactions or other communications between the memory side and the I/Oside.

Root complex 100 also includes IOMMU 110 and is connected to I/O devices132, 134, and 136 through I/O fabric 130. Root complex 100 may also beconnected, directly or indirectly, to memory controller 140, systemmemory 142, processor 144, and/or nonvolatile memory 146, any or all ofwhich may be integrated onto the same silicon chip or other substrate asroot complex 100.

IOMMU 110 includes address translation unit 112, which may represent orinclude any address translation circuit or logic to translate addressesthat may be used by I/O or other peripheral devices to request an accessto system memory 142 to addresses that may be used to access systemmemory 142 (IOMMU DMA remapping). For convenience, the first type ofaddress may be referred to as an VO-side memory address, and may includeaddresses used by I/O devices in DMA transactions, addresses used by I/Odevices in virtual environments, and/or any other addresses used by I/Oor other peripheral devices or within address spaces as seen by I/O orother peripheral devices. The second type of address may be referred toas a memory-side memory address, and may include addresses used bymemory controller 140 to access system memory 142, such as a hostphysical address (HPA), and/or any other address within an address spaceon the system memory side of root complex 100. Address translation unit112 may use any number of page tables, extended page tables, nested pagetables, or other non-hierarchical or hierarchical data structures storedin system memory 142 or elsewhere to perform any number of page walks,lookups, or other translation techniques. IOMMU 110 also includes IOTLB114 to store translations generated by address translation unit 112 orotherwise useful for finding memory-side memory addresses correspondingto I/O-side memory addresses and/or vice versa.

I/O fabric 130 may represent any bus, interconnect, or fabric, such as aPCIe interconnect, through which I/O and/or peripheral devices, such asI/O devices 132, 134, and 136 may be coupled or connected to rootcomplex 100. I/O devices 132, 134, and/or 136 may be devices that may beable to perform the role of a requester and/or a completer of a PCIetransaction, where a “requester” may refer to a device that is able tooriginate a transaction on a I/O fabric 130, a “completer” may refer toa device that is addressed and/or targeted by a requester, and a“transaction” may refer to any transaction, command, message, orcommunication on or through I/O fabric 130. Transactions on I/O fabric130 may include DMA and/or other transactions through which I/O devicesmay access and/or request or attempt to access system memory 144. Moregenerally, a “transaction” may be any communication involving an I/Odevice within a system.

In various embodiments, IOMMU 110 may include hardware, such as addresstranslation unit 112, to perform and/or support translations and/orremappings for transactions involving any I/O device, whether connectedto system memory through a bridge such as bridge 104 or directly, wherethe definition of I/O device may include controllers (such as bus,interconnect, and/or fabric controllers, network interface controllers(NICs, including Omnipath and 100G Ethernet), etc.),processors/accelerators (such as graphics processors, cryptographicand/or compression accelerators, etc.), devices and/or functionsimplemented in field programmable gate arrays or with Intel® QuickAssistTechnology, and any other resources that may use or involve the use ofaddresses in a system, using DMA, Intel® I/O Assist Technology, or anyother techniques, known and/or as described in this specification. Thearchitecture of system 102 may provide for each such physical I/O deviceto be virtualized to provide one or more virtual I/O devices and/orfunctions per physical I/O device, such that the physical I/O devicesmay be assigned/allocated to and/or shared among multiple virtualmachines, partitions, or containers (e.g., separate and/or isolatedexecution environments), supported by the system software, firmware,and/or hardware of system 102.

Any platform, system, or machine, including the “bare metal” platformshown as system 102 in FIG. 1 as well as any VM or other containerabstracted from a bare metal platform, from which one or more containersare abstracted may be referred to as a host or host machine, and each VMor other such container abstracted from a host machine may be referredto as a guest or guest machine. Accordingly, the term “host software”may mean any hypervisor, virtual machine monitor (VMM), operating system(OS), or any other software that may run, execute, or otherwise operateon a host machine and create, maintain, and/or otherwise manage one ormore containers, and the term “guest software” may mean any OS, system,application, user, or other software that may run, execute, or otherwiseoperate on a guest machine. Note that in a layered containerarchitecture, software may be both host software and guest software. Forexample, a first VMM running on a bare metal platform may create a firstVM, in which a second VMM may run and create a second VM abstracted fromthe first VM, in which case the second VMM is both host software andguest software.

For convenience, the use of the term “container process” may mean anycontext, task, application, software, privileged process, unprivilegedprocess, kernel-mode process, supervisor-mode process, user-modeprocess, or any other process running or runnable within a container. Acontainer may have an address space (a container address space or aguest address space) that is different from the system address space(e.g., the address space of system memory 142) or the host address space(e.g. the address space of the host machine). An address with which thesystem address space may be directly accessed (i.e., withouttranslation) may be referred to as an HPA. For isolation, protection, orany other purpose, any container address space may be different from anyother container address space. Therefore, each container process mayaccess memory using addresses that are to be translated, filtered, orotherwise processed to HPAs differently than they are translated,filtered, or otherwise processed for any other container. The differencein translation/processing of container addresses may be due tovirtualization and isolation of container address spaces (e.g., guestsoftware may use guest virtual addresses (GVAs) that are translated toguest physical address spaces (GPAs) that are translated to HPAs) andmay also be due to the use of a variety of different types of containers(e.g., VMs, OS-managed containers, etc.) and/or different containerarchitectures (e.g., layered architectures including VMs hostingmultiple VMs, VMs hosting multiple OS-managed containers, etc.).

An address used by a container process to access memory (a containeraddress) may be any of many different types of addresses, including anHPA, a virtual address, a GPA, a GVA, a DMA address, etc., and may gothrough one or more of any of a variety of techniques, types, levels,layers, rounds, and/or steps of translation, filtering, and/orprocessing, in any combination, using any of a variety of datastructures (e.g., page tables, extended page table, nested page tables,DMA translation tables, memory access filters, memory type filters,memory permission filters, etc.) to result in an HPA and/or in a fault,error, or any other type of determination that a requested access is notallowed. Various approaches may include layering and/or nesting ofcontainers (e.g., a VMM hosting a VM running a guest OS, the guest OSsupporting multiple containers; a VMM hosting multiple VMs each runninga guest OS, etc.), involving various combinations of address translationtechniques.

Each physical function within an I/O device in system 102 may becomeusable and/or shareable by one or more clients (e.g., containers,container processes, host processes, etc.) by reporting to systemsoftware the number of assignable interfaces (AIs) that it supports,where an AI is an abstract entity within a device through which softwaremay submit work to the device. For example, an AI for a NIC may be apaired transmit queue and receive queue; an AI for an InfiniBand, remoteDMA (RDMA), or other host fabric controller may be a Queue Pair; an AIfor a Non-Volatile Memory Express or other storage device controller maybe a Command Queue; an AI for a graphics processing unit (GPU), generalpurpose computing on GPU (GPGPU), or other accelerator may be aschedulable context through which work may be submitted; etc. An AI mayhave multiple command portals, which are typically MMIO addresses thatsoftware may use to submit work. An AI may be distinguished from anadmin portal as being an interface for a client to submit work, whereasan admin portal is an interface through which a container host sets upor configures the AIs.

In an embodiment, an AI may be implemented with one or more 4 KB pagesof memory-mapped I/O (MMIO) registers which are part of the main device(PF) base address registers (BARs). Each AI may correspond to anindividual backend resource (queue, context, etc.) and implement theminimal MMIO interface to configure and operate the respective backendresource. Further, all accesses from a guest driver may be divided intocontrol path accesses, which are infrequent accesses and hence notperformance critical, and fast path accesses, which are frequentdatapath accesses and hence are performance critical. Each AI's controlpath and fast path MMIO registers are laid out in different 4 KB pagesso that the fast path registers may be mapped into the VM for directaccess while control path registers may be emulated in software. One ormore AIs may be assigned to a VM or as part of a virtual device (VDEV).Different AIs from the same device may also be assigned to differentVMs. Virtualization of I/O devices using AIs may be scalable (ScalableIOV) because it is not limited by device/function numbers.

An I/O device may report to host software that it supports one or moreAIs for use according to embodiments of the present invention, as wellas how many AIs it supports, through capability/attribute informationthat it provides according to a system bus or interconnect specification(e.g., through a new capability added to the PCIe specification), by adevice driver for the physical function, or according to any other knowntechnique for reporting physical function capabilities/attributes.

Then, the host software may use the I/O device's admin portal toallocate, map, and/or assign each AI to a client. This assignmentincludes assigning a process address space identifier (PASID) to the AI,where the PASID corresponds to the address space associated with theclient. In an embodiment, a PASID may be a 20-bit tag defined by thePCIe specification and carried by the translation layer packet (TLP)prefix header in transactions generated by the I/O device. After theassignment of an AI has been completed, clients may submit work requeststo it according to any known approach. In an embodiment, clients maysubmit work requests through a shared work queue, using processorenqueuing instructions such as enqueue command (ENQCMD) and enqueuecommand as supervisor (ENQCMDS).

Various approaches to I/O virtualization may include support for sharedvirtual memory (SVM) within VMs and may involve various translations andnesting of translations, including first-level translations (e.g., froma GVA to a GPA) and/or second-level translations from (e.g., from a GPAto a HPA), for AIs and/or VFs/PFs, with or without PASIDs. Furthermore,I/O virtualization may involve virtualization of PASIDs and translationsfrom guest PASIDs to host PASIDs, for example, in connection with sharedwork queues and/or ENQCMD/S instructions. Additionally, an OS (e.g.,Linux) may use I/O virtual addresses (IOVA) to program DMA on I/Odevices. A VF/PF transaction may involve a request including an IOVA butno PASID, while an AI transaction for the same I/O device may involve arequest including a guest IOVA (GIOVA) and a PASID.

Various scenarios may arise in which the use of various I/O devices mayinvolve different translation techniques and/or transaction attributes.The use of multiple address translation techniques may be incompatiblewith existing IOMMU architectures. Examples include: SR-IOV and ScalableIOV use different second level translation structures; a second leveltranslation for an IOVA may not be available if it is used to supportSVM; and use by a VM of VFs/PFs with dedicated work queues (using hostPASIDs) and shared work queues (using guest PASIDs) and/or assignment ofboth VFs/PFs (using guest PASIDs) and AIs (using host PASIDs) to asingle VM may result in a single application and/or VM using differenttypes of remapping requests.

Embodiments of the invention provide for translation of addresses tosupport a variety of approaches to I/O virtualization, including SR-IOVand/or Scalable IOV, using a single IOMMU. FIG. 2 illustrates an IOMMUaccording to such an embodiment, and FIG. 3 and FIG. 4 show moredetailed examples of embodiments.

In FIG. 2 , IOMMU 200 may include root table lookup circuitry 210 tofind an entry in a root table, such as root table 214. Root table 214may be a data structure in local memory of IOMMU 200, in system memory,and/or elsewhere in the system, in which one or more root-entries (e.g.,root-entry 216) may be stored. Root table 214 may have a root table baseaddress stored in a root table pointer storage location 212. Root tablelookup circuitry 210 may include circuitry to add a root table index tothe root table base address, where the root table index may correspondto a bus number in an embodiment in which an identifier of an I/O devicemay include a bus number. For example, an I/O device in a systemincluding a PCIe bus may be assigned a bus number, device number, andfunction number (BDF) by system configuration software or firmware.

IOMMU 200 may also include context table lookup circuitry 220 to find anentry in a context table, such as context table 224. Context table 224may be a data structure in local memory of IOMMU 200, in system memory,and/or elsewhere in the system, in which one or more context-entries(e.g., context-entry 226) may be stored. Embodiments of the inventionmay include any number of context tables, each with any number ofcontext-entry locations. Context table 224 may have a context table baseaddress stored in a root-entry location (e.g., root-entry 216). Contexttable lookup circuitry 220 may include circuitry to add a context tableindex to the context table base address, where the context table indexmay correspond to a device and function number in an embodiment in whichan identifier of an I/O device may include a device and function number(e.g., a PCIe BDF).

IOMMU 200 may also include PASID table lookup circuitry 230 to find anentry in a PASID table, such as PASID table 234. PASID table 234 may bea data structure in local memory of IOMMU 200, in system memory, and/orelsewhere in the system, in which one or more PASID-entries (e.g.,PASID-entry 236) may be stored. Embodiments of the present invention mayinclude any number of PASID tables, each with any number of PASID-entrylocations. PASID table 234 may have a PASID table base address stored ina context-entry location (e.g., context-entry 226). PASID table lookupcircuitry 230 may include circuitry to add a PASID table index to thePASID table base address, where the PASID table index may correspond toa PASID.

In translation architecture 300 of FIG. 3 , root table 314 may store oneor more root entries and be indexed by bus number. A root entry mayinclude a context table pointer to point to a context table (e.g., rootentry N may point to context table 324), which may store one or morescalable context entries and be indexed by device/function number. Ascalable context entry may include a scalable PASID table pointer topoint to a scalable PASID table (e.g., context entry O and/or P maypoint to system-wide PASID table 334), which may store one or morescalable PASID entries and be indexed by PASID number. A system-wide,global PASID table may be maintained by a host OS/VMM such that allcontext entries in all IOMMUs point to the global PASID table. Inanother embodiment, different IOMMUs or different context entries withineach IOMMU may point to different PASID tables. In this case, the hostOS/VMM still maintains a global PASID space such that PASIDs areallocated/freed from a single global (host) PASID space and only thesePASID entries are configured in per-IOMMU or per-context PASID tables.

Additionally or alternatively, a context entry may include a secondlevel pointer to point to second level page tables for translating a GPAor an IOVA/GIOVA to an HPA (e.g., context entry P may include a secondlevel pointer to point to second level page tables 344). Therefore,translation architecture 300 may support translation requests for aVF/PF without a PASID. A context entry may include a nesting bit tospecify whether a PASID table pointer and a second level pointer is tobe used to perform nested translation for translation requests with aPASID.

A scalable PASID entry may include a first level pointer to point tofirst level page tables for translating a GVA to a GPA (e.g., PASIDentry Q may include a first level pointer to point to first level pagetables 354) and/or a second level pointer to point to second level pagetables for translating a GPA or an IOVA/GIOVA to an HPA (e.g., PASIDentry Q may include a second level pointer to point to second level pagetables 364). Therefore, translation architecture 300 may supporttranslation requests, with a PASID, for an AI and a VF/PF. A PASID entrymay include one or more control fields, such as a translation type fieldor a nesting field, to specify whether a first level pointer or a secondlevel pointer or both pointers are to be used to perform translation fortranslation requests with a PASID.

In translation architecture 400 of FIG. 4 , root table 414 may store oneor more root entries and be indexed by bus number. A root entry mayinclude a context table pointer to point to a context table (e.g., rootentry N may point to context table 424), which may store one or morescalable context entries and be indexed by device/function number. Ascalable context entry may include a scalable PASID table pointer topoint to a scalable PASID table (e.g., context entry O and/or P maypoint to system-wide PASID table 434), which may store one or morescalable PASID entries and be indexed by PASID number. A system-wide,global PASID table may be maintained by a host OS/VMM such that allcontext entries in all IOMMUs point to the global PASID table. Inanother embodiment, different IOMMUs or different context entries withineach IOMMU may point to different PASID tables. In this case, the hostOS/VMM still maintains a global PASID space such that PASIDs areallocated/freed from a single global (host) PASID space and only thesePASID entries are configured in per-IOMMU or per-context PASID tables.

Additionally or alternatively, a context entry may include, instead of asecond level pointer, a RID2PASID field, which may be programmed by aVMM to assign a host PASID to requests without a PASID. The VMM may alsoprogram the corresponding PASID table entry with a first and/or a secondlevel pointer. For example, context entry P may include an RID2PASIDfield. Therefore, translation architecture 400 may support translationrequests for a VF/PF without a PASID.

A scalable PASID entry may include a first level pointer to point tofirst level page tables for translating a GVA to a GPA (e.g., PASIDentry Q may include a first level pointer to point to first level pagetables 454) and/or a second level pointer to point to second level pagetables for translating a GPA or an IOVA/GIOVA to an HPA (e.g., PASIDentry Q may include a second level pointer to point to second level pagetables 464). Therefore, translation architecture 400 may supporttranslation requests, with a PASID, for an AI and a VF/PF. A PASID entrymay include one or more control fields, such as a translation type fieldor a nesting field, to specify whether a first level pointer or a secondlevel pointer or both pointers are to be used to perform translation fortranslation requests with a PASID.

FIGS. 5A and 5B illustrate unified PASID management according toembodiments of the invention, including an IOMMU virtualizationmechanism that presents a virtual IOMMU (vIOMMU) to a VM for IOVA andSVM operations. In one embodiment, the vIOMMU emulates anon-Scalable-IOV capable IOMMU (i.e., an IOMMU that can only supportVFs/PFs according to SR-IOV). Abs are encapsulated in virtual devicesand presented to VMs as PFs. This technique allows the VM to use thesame mechanisms for VFs/PFs and Abs. For supporting GVA on both VFs/PFsand Abs assigned to a VM, the VMM shadows the guest PASID table tocreate a shadow PASID table for the VM in the physical IOMMU. The shadowPASID table is pointed to by the assigned VF/PF's context entry, whilethe AI's context entry points to the system-wide host PASID table. TheVMM exposes a smaller PASID table size in the vIOMMU so the guest PASIDsoccupy only a portion of the physical PASID table. The VMM configuresguest PASIDs in the VM's shadowed PASID table to support assignedVFs/PFs. The VMM also allocates host PASIDs corresponding to the VM'sguest PASIDs and configures them in the system-wide host PASID table tosupport assigned AIs. Therefore, if an application in a VM is assignedboth SVM-capable VFs/PFs and AIs, the VMM may configure an application'sguest PASID for VFs/PFs in the VM's shadow PASID table and theapplication's host PASID for AIs in the system-wide host PASID table.The VMM may also configure the application's host PASID in the VM'sshadow PASID table for VFs/PFs that use ENQCMD/S instructions. The PASIDentry second-level pointer may be configured to point to a second-leveltable for nested GPA-to-HPA translation for both VFs/PFs and AIs.

In block 510 of method 500 of FIG. 5A, a VMM creates a virtual IOMMU(vIOMMU) for a VM to which a VF/PF and an AI may be assigned and/or inwhich hot-plug-in of new devices is supported. The vIOMMU (e.g., vIOMMU550 in FIG. 5B) supports a smaller PASID width than that supported bythe corresponding physical IOMMU. For example, if the PASID widthsupported by the physical IOMMU is 20 bits, the PASID width supported bythe vIOMMU may be 10 bits. Therefore, the VMM may shadow the guest PASIDtable of the vIOMMU to a scalable PASID table, pointed to by the VF/PFscontext entry, that is private to the VF/PF device (e.g., shadow PASIDtable 560 in FIG. 5B).

In block 520, for each guest PASID in the guest PASID table, the VMMcreates a corresponding entry in the shadowed PASID table, with nestingenabled to provide for first-level translation from the guest PASIDtable (GVA to GPA) and second-level translation using the hostGPA-to-HPA table. If the PASID is used with a VF/PF (without ENQCMD/S),the device operates directly using the guest PASID. Since the guestPASID space is smaller than the physical PASID space, there are morePASID entries available (above the guest PASID range) in the shadowedPASID table. The PASID space above the guest PASID range is not visibleto the VM, so it may be used by the VMM to configure host PASIDs in theshadowed PASID table. Additionally, the VMM never allocates orconfigures any host PASID values in the guest PASID range for any VMs inthe system-wide host PASID table.

In block 530, to support PASID virtualization, the VMM may allocate ahost PASID (above the guest PASID range) for each guest PASID used by anAI or ENQCMD/S instructions. The corresponding host PASID entry in theshadowed PASID table is also programmed with nesting enabled, withfirst-level table translation from the guest PASID table (GVA to GPA),and second-level translation using the host GPA-to-HPA table. The VMMalso configures the host PASID entry in the system-wide host PASID tablewith nesting enabled for with first-level translation using theguest-PASID table (GVA to GPA), and second-level translation using thehost GPA-to-HPA table.

Since the VM can program arbitrary guest PASIDs (including a guest PASIDvalue above the guest PASID range) into the VF/PF, the VM can cause theVF/PF to use a host PASID illegally. However, it will not cause any harmto any other VM or the VMM because the VMM configures only host PASIDsthat correspond to the particular VM's guest PASIDs in its shadow PASIDtable. Therefore, an invalid guest PASID value programmed in the VF/PFwill cause an IOMMU fault (if the guest PASID is not configured in theshadow PASID table) or will cause the VF/PF to access an addressbelonging to another PASID of the same VM (if the guest PASID isconfigured in the shadow PASID table).

For example, an application inside VM1 may be assigned both a VF/PF(physical context entry P) and an AI (physical context entry O). If theVF/PF uses a guest PASID (non ENQCMD/S based method), the IOMMU performsDMA remapping using the guest PASID in the shadowed PASID table. If theVF/PF uses a host PASID (ENQCMD/S based method), the IOMMU performs DMAremapping using the host PASID in the shadowed PASID table. If an AIdoes a DMA request (irrespective of ENQCMD/S), it will always be with ahost PASID. In this case, the IOMMU uses the host PASID entry in thesystem wide host PASID table to perform DMA remapping. Since all threePASID entries are pointing to the same set of first-level andsecond-level translation tables, all of these DMA remapping requestswill result in the same HPA addresses for the application.

An application inside a misbehaving VM2 may be assigned a VF/PF(physical context entry N) which may program an arbitrary guest PASID tothe VF/PF. VM2 programs guest PASID r in its vIOMMU PASID table, whichcauses the VMM to configure the guest PASID r in VM2's shadow PASIDtable as well as allocate a host PASID R and configure it in VM2'sshadow PASID table. So even if VM2 programs the VF/PF to use host PASIDQ (which belongs to VM1), it cannot access VM1's memory because VM2'sshadow PASID table does not have host PASID Q configured. VM2's attemptwill result in an IOMMU fault instead.

FIGS. 6A and 6B illustrate unified PASID management according to yetanother embodiment of the invention, including an IOMMUpara-virtualization mechanism in which a VMM presents a vIOMMU to a VMand exposes a set of services to configure a physical IOMMU for IOVA andSVM operations. AIs may be encapsulated in virtual devices and presentedto VMs as PFs. This technique allows the VM to use the same mechanismsfor VFs/PFs and AIs. For IOVA and SVM operations, the VMM uses a globalPASID space rather than requiring each VM to implement its own PASIDspace (guest PASIDs). The VMM manages a global pool of PASIDs which isused to allocate PASIDs for Scalable IOV AIs' second-level translations(IOVA operation) and to allocate PASIDs for SVM applications runninginside VMs requesting GVA operation for devices (VF/PF devices orvirtual devices made-up of AIs). The VMM may control the maximum numberof PASIDs allocated to a particular VM to assure a fair share of PASIDspace between different VMs and the VMM. The VMM may use a scalablePASID table that is private to a VF/PF device or to a VM, pointed to bythe VF/PF's context entry, to support SVM operations on a VF/PF device.The VMM may use a system-wide scalable PASID table or one scalable PASIDtable for each physical IOMMU to support SVM operations on AIs.

In block 602 of method 600 of FIG. 6A, a VMM creates a vIOMMU for a VMto which a VF/PF and an AI may be assigned and/or in which hot-plug-inof new devices is supported. The vIOMMU (e.g., vIOMMU 610 in FIG. 6B)may not allocate its own translation tables or PASIDs, but may rely onIOMMU services provided by the VMM to achieve SVM and IOVAfunctionality. For each operation on vIOMMU that involves modificationof IOMMU registers or IOMMU translation tables, vIOMMU software runninginside a VM calls into the VMM and requests the VMM to perform theoperation on its behalf. The VMM may service the request or may deny itif invalid parameters are passed in the call. The VMM creates a globalPASID space (e.g. global PASID space 620 in FIG. 6B) and allocates orfrees PASIDs from this PASID space based on its own needs or as a resultof operations that are initiated by VMs through the vIOMMU. To enableGVA operation, vIOMMU software running in a VM may utilize IOMMUservices provided by the VMM to acquire PASIDs (in block 604) to beprogrammed in the device and to communicate a base for GVA-to-GPA pagingstructures for first-level translation.

In block 606, for each vIOMMU request to enable GVA operation for theapplication, the VMM allocates a host PASID (e.g. PASID 630 in FIG. 6B)if one is not already allocated for it. The VMM creates a correspondingentry in the particular VM's scalable PASID table (e.g. PASID table 640in FIG. 6B) if the request is for a VF/PF device and in the AI'sscalable PASID table (e.g. PASID table 650 in FIG. 6B) if the request isfor an AI, with nesting enabled to provide for first-level translationusing guest GVA-to-GPA table (e.g. arrow 660 in FIG. 6B) andsecond-level translation using the host GPA-to-HPA table (e.g. arrow 670or arrow 680 in FIG. 6B). The VMM also returns the host PASID to thevIOMMU software in the VM, which can be used as the guest PASID (PASID690 in FIG. 6B) for normal guest PASID usages.

Since the VM can program arbitrary PASIDs (including a PASID value notallocated to it by the VMM) into the VF/PF, the VM can cause the VF/PFto use a PASID illegally. However, it will not cause any harm to anyother VM or the VMM because the VMM configures a context-entry for theVF/PF device to use the particular VM's PASID table, in which validentries correspond only to PASIDs that have been allocated to theparticular VM by the VMM. Therefore, an invalid PASID value programmedin the VF/PF will cause an IOMMU fault (if the PASID is not configuredin the particular VM's PASID table) or will cause the VF/PF to access anaddress belonging to another PASID of the same VM (if the PASID isconfigured in the particular VM's PASID table).

For example, an application inside VM1 may be assigned both a VF/PF(physical context entry P) and an AI (physical context entry O). If theVF/PF uses a PASID Q (irrespective of ENQCMD/S), the IOMMU performs DMAremapping using the PASID Q in the VM1's PASID table. If an AI does aDMA request (irrespective of ENQCMD/S), the IOMMU uses the PASID Q entryin the AI PASID table to perform DMA remapping. Since both the PASID Qentries are pointing to the same set of first-level and second-leveltranslation tables, all of these DMA remapping requests will result inthe same HPA addresses for the application.

An application inside a misbehaving VM2 may be assigned a VF/PF(physical context entry N) which may program an arbitrary PASID to theVF/PF. When VM2 requests SVM enable for an application, the VMMallocates a PASID R and configures it in VM2's PASID table. So even ifVM2 programs the VF/PF to use host PASID Q (which belongs to VM1), itcannot access VM1's memory because VM2's PASID table does not have PASIDQ configured. VM2's attempt will result in an IOMMU fault instead.

FIGS. 7A, 7B, and 8 illustrate IOVA virtualization according toembodiments of the invention. The software-based embodiment of FIG. 7Aincludes shadowing of the vIOMMU's second-level table (GIOVA-to-GPA) tocreate (GIOVA-to-HPA) mappings in the physical IOMMU's correspondingsecond-level table, i.e., for VFs/PFs, the context entry second-leveltable is used, and for AIs, the PASID entry second-level table is used.The software-based embodiment of FIG. 7B includes a vIOMMU utilizing VMMservices to add or remove mappings in an IOVA-to-HPA table allocated bythe VMM representing I/O space of the VM or the I/O space of device andthe VMM configuring a physical IOMMU's context entry (for VFs/PFs) andPASID entry (for AIs) to use this table for second-level translation.The hardware-based embodiment of FIG. 8 includes enhancing the physicalIOMMU to perform nested second level (GIOVA-to-GPA-to-HPA) translationsfrom the vIOMMU's second-level table (GIOVA-to-GPA) to the physicalIOMMU's second level (GPA-to-HPA) table.

FIG. 7A illustrates a software-based approach to IOVA virtualizationaccording to an embodiment of the invention. In method 700, the VMMshadows the GIOVA-to-GPA page table from the vIOMMU in the VM to aGIOVA-to-HPA page table in the physical IOMMU in the host. In block 710,when the VM configures the vIOMMU's GIOVA-to-GPA mappings, the VMMintercepts and programs the corresponding GIOVA-to-HPA mappings in thephysical IOMMU's corresponding context entry's second-level table forthe VF/PF. In block 720, if the VM also uses SVM on the VF/PF, the VMMprograms the GPA-to-HPA mappings in the VM's shadow PASID table'scorresponding scalable PASID entry second-level table. Both the guestPASID entry and the corresponding host PASID entry are configured topoint to the GPA-to-HPA table (arrows 570 in shadow PASID tables of FIG.5B). This approach enables the VM to use both IOVA and SVM on the VF/PFsimultaneously. It may be preferred over a hardware approach usingnested translation, as described below, if the VM updates itsGIOVA-to-GPA table infrequently.

FIG. 7B illustrates a software-based approach to IOVA virtualizationaccording to an embodiment of the invention. In block 760 of method 700,the VMM creates a vIOMMU and exposes IOMMU services for GVA and IOVAoperations that are invoked by vIOMMU software running inside the VM.The VMM creates an IOVA-to-HPA table that is representing I/O space ofthe VM and configures the physical IOMMU's context-entry (for VFs/PFs)or PASID entry (for AIs) to use this table. In block 770, the VMM addsor removes a mapping in the IOVA-to-HPA table based on the request fromthe vIOMMU.

FIG. 8 illustrates a hardware-based approach to IOVA virtualizationaccording to an embodiment of the invention. Physical IOMMU 800 isenhanced to support a 2nd-over-2nd nested translation, i.e., IOMMU 800has the ability to do GIOVA-to-GPA-to-HPA nested translations. Thescalable PASID entry is extended to include an additional second levelpointer for GIOVA nested translation requests with a PASID (for scalableIOVAs). Additionally, the scalable context entry is extended to includean additional second level pointer for the GIOVA nested translationrequests without PASID (for VF/PF). Since now there are different tablesfor IOVA-to-HPA and GPA-to-HPA, it allows VMs to use both IOVA and SVMon the assigned I/O device (VF/PF or AI). This approach may be preferredover a software approach, as described above, because it can performGIOVA-to-GPA-to-HPA translations without VMM intercept and shadowingoverhead.

Exemplary Core Architectures, Processors, and Computer Architectures

The figures below detail exemplary architectures and systems toimplement embodiments of the above.

Processor cores may be implemented in different ways, for differentpurposes, and in different processors. For instance, implementations ofsuch cores may include: 1) a general purpose in-order core intended forgeneral-purpose computing; 2) a high performance general purposeout-of-order core intended for general-purpose computing; 3) a specialpurpose core intended primarily for graphics and/or scientific(throughput) computing. Implementations of different processors mayinclude: 1) a CPU including one or more general purpose in-order coresintended for general-purpose computing and/or one or more generalpurpose out-of-order cores intended for general-purpose computing; and2) a coprocessor including one or more special purpose cores intendedprimarily for graphics and/or scientific (throughput). Such differentprocessors lead to different computer system architectures, which mayinclude: 1) the coprocessor on a separate chip from the CPU; 2) thecoprocessor on a separate die in the same package as a CPU; 3) thecoprocessor on the same die as a CPU (in which case, such a coprocessoris sometimes referred to as special purpose logic, such as integratedgraphics and/or scientific (throughput) logic, or as special purposecores); and 4) a system on a chip that may include on the same die thedescribed CPU (sometimes referred to as the application core(s) orapplication processor(s)), the above described coprocessor, andadditional functionality. Exemplary core architectures are describednext, followed by descriptions of exemplary processors and computerarchitectures.

Exemplary Core Architectures In-order and Out-of-order Core BlockDiagram

FIG. 9A is a block diagram illustrating both an exemplary in-orderpipeline and an exemplary register renaming, out-of-orderissue/execution pipeline according to embodiments of the invention. FIG.9B is a block diagram illustrating both an exemplary embodiment of anin-order architecture core and an exemplary register renaming,out-of-order issue/execution architecture core to be included in aprocessor according to embodiments of the invention. The solid linedboxes in FIGS. 9A-B illustrate the in-order pipeline and in-order core,while the optional addition of the dashed lined boxes illustrates theregister renaming, out-of-order issue/execution pipeline and core. Giventhat the in-order aspect is a subset of the out-of-order aspect, theout-of-order aspect will be described.

In FIG. 9A, a processor pipeline 900 includes a fetch stage 902, alength decode stage 904, a decode stage 906, an allocation stage 908, arenaming stage 910, a scheduling (also known as a dispatch or issue)stage 912, a register read/memory read stage 914, an execute stage 916,a write back/memory write stage 918, an exception handling stage 922,and a commit stage 924.

FIG. 9B shows processor core 990 including a front end unit 930 coupledto an execution engine unit 950, and both are coupled to a memory unit970. The core 990 may be a reduced instruction set computing (RISC)core, a complex instruction set computing (CISC) core, a very longinstruction word (VLIW) core, or a hybrid or alternative core type. Asyet another option, the core 990 may be a special-purpose core, such as,for example, a network or communication core, compression engine,coprocessor core, general purpose computing graphics processing unit(GPGPU) core, graphics core, or the like.

The front end unit 930 includes a branch prediction unit 932, which iscoupled to an instruction cache unit 934, which is coupled to aninstruction translation lookaside buffer (TLB) 936, which is coupled toan instruction fetch unit 938, which is coupled to a decode unit 940.The decode unit 940 (or decoder) may decode instructions, and generateas an output one or more micro-operations, micro-code entry points,microinstructions, other instructions, or other control signals, whichare decoded from, or which otherwise reflect, or are derived from, theoriginal instructions. The decode unit 940 may be implemented usingvarious different mechanisms. Examples of suitable mechanisms include,but are not limited to, look-up tables, hardware implementations,programmable logic arrays (PLAs), microcode read only memories (ROMs),etc. In one embodiment, the core 990 includes a microcode ROM or othermedium that stores microcode for certain macroinstructions (e.g., indecode unit 940 or otherwise within the front end unit 930). The decodeunit 940 is coupled to a rename/allocator unit 952 in the executionengine unit 950.

The execution engine unit 950 includes the rename/allocator unit 952coupled to a retirement unit 954 and a set of one or more schedulerunit(s) 956. The scheduler unit(s) 956 represents any number ofdifferent schedulers, including reservations stations, centralinstruction window, etc. The scheduler unit(s) 956 is coupled to thephysical register file(s) unit(s) 958. Each of the physical registerfile(s) units 958 represents one or more physical register files,different ones of which store one or more different data types, such asscalar integer, scalar floating point, packed integer, packed floatingpoint, vector integer, vector floating point, status (e.g., aninstruction pointer that is the address of the next instruction to beexecuted), etc. In one embodiment, the physical register file(s) unit958 comprises a vector registers unit, a write mask registers unit, anda scalar registers unit. These register units may provide architecturalvector registers, vector mask registers, and general purpose registers.The physical register file(s) unit(s) 958 is overlapped by theretirement unit 954 to illustrate various ways in which registerrenaming and out-of-order execution may be implemented (e.g., using areorder buffer(s) and a retirement register file(s); using a futurefile(s), a history buffer(s), and a retirement register file(s); using aregister maps and a pool of registers; etc.). The retirement unit 954and the physical register file(s) unit(s) 958 are coupled to theexecution cluster(s) 960. The execution cluster(s) 960 includes a set ofone or more execution units 962 and a set of one or more memory accessunits 964. The execution units 962 may perform various operations (e.g.,shifts, addition, subtraction, multiplication) and on various types ofdata (e.g., scalar floating point, packed integer, packed floatingpoint, vector integer, vector floating point). While some embodimentsmay include a number of execution units dedicated to specific functionsor sets of functions, other embodiments may include only one executionunit or multiple execution units that all perform all functions. Thescheduler unit(s) 956, physical register file(s) unit(s) 958, andexecution cluster(s) 960 are shown as being possibly plural becausecertain embodiments create separate pipelines for certain types ofdata/operations (e.g., a scalar integer pipeline, a scalar floatingpoint/packed integer/packed floating point/vector integer/vectorfloating point pipeline, and/or a memory access pipeline that each havetheir own scheduler unit, physical register file(s) unit, and/orexecution cluster—and in the case of a separate memory access pipeline,certain embodiments are implemented in which only the execution clusterof this pipeline has the memory access unit(s) 964). It should also beunderstood that where separate pipelines are used, one or more of thesepipelines may be out-of-order issue/execution and the rest in-order.

The set of memory access units 964 is coupled to the memory unit 970,which includes a data TLB unit 972 coupled to a data cache unit 974coupled to a level 2 (L2) cache unit 976. In one exemplary embodiment,the memory access units 964 may include a load unit, a store addressunit, and a store data unit, each of which is coupled to the data TLBunit 972 in the memory unit 970. The instruction cache unit 934 isfurther coupled to a level 2 (L2) cache unit 976 in the memory unit 970.The L2 cache unit 976 is coupled to one or more other levels of cacheand eventually to a main memory.

By way of example, the exemplary register renaming, out-of-orderissue/execution core architecture may implement the pipeline 900 asfollows: 1) the instruction fetch 938 performs the fetch and lengthdecoding stages 902 and 904; 2) the decode unit 940 performs the decodestage 906; 3) the rename/allocator unit 952 performs the allocationstage 908 and renaming stage 910; 4) the scheduler unit(s) 956 performsthe schedule stage 912; 5) the physical register file(s) unit(s) 958 andthe memory unit 970 perform the register read/memory read stage 914; theexecution cluster 960 perform the execute stage 916; 6) the memory unit970 and the physical register file(s) unit(s) 958 perform the writeback/memory write stage 918; 7) various units may be involved in theexception handling stage 922; and 8) the retirement unit 954 and thephysical register file(s) unit(s) 958 perform the commit stage 924.

The core 990 may support one or more instructions sets (e.g., the x86instruction set (with some extensions that have been added with newerversions); the MIPS instruction set of MIPS Technologies of Sunnyvale,CA; the ARM instruction set (with optional additional extensions such asNEON) of ARM Holdings of Sunnyvale, CA), including the instruction(s)described herein. In one embodiment, the core 990 includes logic tosupport a packed data instruction set extension (e.g., AVX1, AVX2),thereby allowing the operations used by many multimedia applications tobe performed using packed data.

It should be understood that the core may support multithreading(executing two or more parallel sets of operations or threads), and maydo so in a variety of ways including time sliced multithreading,simultaneous multithreading (where a single physical core provides alogical core for each of the threads that physical core issimultaneously multithreading), or a combination thereof (e.g., timesliced fetching and decoding and simultaneous multithreading thereaftersuch as in the Intel® Hyperthreading technology).

While register renaming is described in the context of out-of-orderexecution, it should be understood that register renaming may be used inan in-order architecture. While the illustrated embodiment of theprocessor also includes separate instruction and data cache units934/974 and a shared L2 cache unit 976, alternative embodiments may havea single internal cache for both instructions and data, such as, forexample, a Level 1 (L1) internal cache, or multiple levels of internalcache. In some embodiments, the system may include a combination of aninternal cache and an external cache that is external to the core and/orthe processor. Alternatively, all of the cache may be external to thecore and/or the processor.

FIG. 10 is a block diagram of a processor 1000 that may have more thanone core, may have an integrated memory controller, and may haveintegrated graphics according to embodiments of the invention. The solidlined boxes in FIG. 10 illustrate a processor 1000 with a single core1002A, a system agent 1010, a set of one or more bus controller units1016, while the optional addition of the dashed lined boxes illustratesan alternative processor 1000 with multiple cores 1002A-N, a set of oneor more integrated memory controller unit(s) 1014 in the system agentunit 1010, and special purpose logic 1008.

Thus, different implementations of the processor 1000 may include: 1) aCPU with the special purpose logic 1008 being integrated graphics and/orscientific (throughput) logic (which may include one or more cores), andthe cores 1002A-N being one or more general purpose cores (e.g., generalpurpose in-order cores, general purpose out-of-order cores, acombination of the two); 2) a coprocessor with the cores 1002A-N being alarge number of special purpose cores intended primarily for graphicsand/or scientific (throughput); and 3) a coprocessor with the cores1002A-N being a large number of general purpose in-order cores. Thus,the processor 1000 may be a general-purpose processor, coprocessor orspecial-purpose processor, such as, for example, a network orcommunication processor, compression engine, graphics processor, GPGPU(general purpose graphics processing unit), a high-throughput manyintegrated core (MIC) coprocessor (including 30 or more cores), embeddedprocessor, or the like. The processor may be implemented on one or morechips. The processor 1000 may be a part of and/or may be implemented onone or more substrates using any of a number of process technologies,such as, for example, BiCMOS, CMOS, or NMOS.

The memory hierarchy includes one or more levels of cache within thecores, a set or one or more shared cache units 1006, and external memory(not shown) coupled to the set of integrated memory controller units1014. The set of shared cache units 1006 may include one or moremid-level caches, such as level 2 (L2), level 3 (L3), level 4 (L4), orother levels of cache, a last level cache (LLC), and/or combinationsthereof. While in one embodiment a ring based interconnect unit 1012interconnects the integrated graphics logic 1008 (integrated graphicslogic 1008 is an example of and is also referred to herein as specialpurpose logic), the set of shared cache units 1006, and the system agentunit 1010/integrated memory controller unit(s) 1014, alternativeembodiments may use any number of well-known techniques forinterconnecting such units. In one embodiment, coherency is maintainedbetween one or more cache units 1006 and cores 1002-A-N.

In some embodiments, one or more of the cores 1002A-N are capable ofmulti-threading. The system agent 1010 includes those componentscoordinating and operating cores 1002A-N. The system agent unit 1010 mayinclude for example a power control unit (PCU) and a display unit. ThePCU may be or include logic and components needed for regulating thepower state of the cores 1002A-N and the integrated graphics logic 1008.The display unit is for driving one or more externally connecteddisplays.

The cores 1002A-N may be homogenous or heterogeneous in terms ofarchitecture instruction set; that is, two or more of the cores 1002A-Nmay be capable of execution the same instruction set, while others maybe capable of executing only a subset of that instruction set or adifferent instruction set.

Exemplary Computer Architectures

FIGS. 11-14 are block diagrams of exemplary computer architectures.Other system designs and configurations known in the arts for laptops,desktops, handheld PCs, personal digital assistants, engineeringworkstations, servers, network devices, network hubs, switches, embeddedprocessors, digital signal processors (DSPs), graphics devices, videogame devices, set-top boxes, micro controllers, cell phones, portablemedia players, hand held devices, and various other electronic devices,are also suitable. In general, a huge variety of systems or electronicdevices capable of incorporating a processor and/or other executionlogic as disclosed herein are generally suitable.

Referring now to FIG. 11 , shown is a block diagram of a system 1100 inaccordance with one embodiment of the present invention. The system 1100may include one or more processors 1110, 1115, which are coupled to acontroller hub 1120. In one embodiment, the controller hub 1120 includesa graphics memory controller hub (GMCH) 1190 and an Input/Output Hub(IOH) 1150 (which may be on separate chips); the GMCH 1190 includesmemory and graphics controllers to which are coupled memory 1140 and acoprocessor 1145; the IOH 1150 couples input/output (I/O) devices 1160to the GMCH 1190. Alternatively, one or both of the memory and graphicscontrollers are integrated within the processor (as described herein),the memory 1140 and the coprocessor 1145 are coupled directly to theprocessor 1110, and the controller hub 1120 in a single chip with theIOH 1150.

The optional nature of additional processors 1115 is denoted in FIG. 11with broken lines. Each processor 1110, 1115 may include one or more ofthe processing cores described herein and may be some version of theprocessor 1000.

The memory 1140 may be, for example, dynamic random access memory(DRAM), phase change memory (PCM), or a combination of the two. For atleast one embodiment, the controller hub 1120 communicates with theprocessor(s) 1110, 1115 via a multi-drop bus, such as a frontside bus(FSB), point-to-point interface such as QuickPath Interconnect (QPI), orsimilar connection 1195.

In one embodiment, the coprocessor 1145 is a special-purpose processor,such as, for example, a high-throughput MIC processor, a network orcommunication processor, compression engine, graphics processor, GPGPU,embedded processor, or the like. In one embodiment, controller hub 1120may include an integrated graphics accelerator.

There can be a variety of differences between the physical resources1110, 1115 in terms of a spectrum of metrics of merit includingarchitectural, microarchitectural, thermal, power consumptioncharacteristics, and the like.

In one embodiment, the processor 1110 executes instructions that controldata processing operations of a general type. Embedded within theinstructions may be coprocessor instructions. The processor 1110recognizes these coprocessor instructions as being of a type that shouldbe executed by the attached coprocessor 1145. Accordingly, the processor1110 issues these coprocessor instructions (or control signalsrepresenting coprocessor instructions) on a coprocessor bus or otherinterconnect, to coprocessor 1145. Coprocessor(s) 1145 accept andexecute the received coprocessor instructions.

Referring now to FIG. 12 , shown is a block diagram of a first morespecific exemplary system 1200 in accordance with an embodiment of thepresent invention. As shown in FIG. 12 , multiprocessor system 1200 is apoint-to-point interconnect system, and includes a first processor 1270and a second processor 1280 coupled via a point-to-point interconnect1250. Each of processors 1270 and 1280 may be some version of theprocessor 1000. In one embodiment of the invention, processors 1270 and1280 are respectively processors 1110 and 1115, while coprocessor 1238is coprocessor 1145. In another embodiment, processors 1270 and 1280 arerespectively processor 1110 and coprocessor 1145.

Processors 1270 and 1280 are shown including integrated memorycontroller (IMC) units 1272 and 1282, respectively. Processor 1270 alsoincludes as part of its bus controller units point-to-point (P-P)interfaces 1276 and 1278; similarly, second processor 1280 includes P-Pinterfaces 1286 and 1288. Processors 1270, 1280 may exchange informationvia a point-to-point (P-P) interface 1250 using P-P interface circuits1278, 1288. As shown in FIG. 12 , IMCs 1272 and 1282 couple theprocessors to respective memories, namely a memory 1232 and a memory1234, which may be portions of main memory locally attached to therespective processors.

Processors 1270, 1280 may each exchange information with a chipset 1290via individual P-P interfaces 1252, 1254 using point to point interfacecircuits 1276, 1294, 1286, 1298. Chipset 1290 may optionally exchangeinformation with the coprocessor 1238 via a high-performance interface1292. In one embodiment, the coprocessor 1238 is a special-purposeprocessor, such as, for example, a high-throughput MIC processor, anetwork or communication processor, compression engine, graphicsprocessor, GPGPU, embedded processor, or the like.

A shared cache (not shown) may be included in either processor oroutside of both processors, yet connected with the processors via P-Pinterconnect, such that either or both processors' local cacheinformation may be stored in the shared cache if a processor is placedinto a low power mode.

Chipset 1290 may be coupled to a first bus 1216 via an interface 1296.In one embodiment, first bus 1216 may be a Peripheral ComponentInterconnect (PCI) bus, or a bus such as a PCI Express bus or anotherthird generation I/O interconnect bus, although the scope of the presentinvention is not so limited.

As shown in FIG. 12 , various I/O devices 1214 may be coupled to firstbus 1216, along with a bus bridge 1218 which couples first bus 1216 to asecond bus 1220. In one embodiment, one or more additional processor(s)1215, such as coprocessors, high-throughput MIC processors, GPGPU's,accelerators (such as, e.g., graphics accelerators or digital signalprocessing (DSP) units), field programmable gate arrays, or any otherprocessor, are coupled to first bus 1216. In one embodiment, second bus1220 may be a low pin count (LPC) bus. Various devices may be coupled toa second bus 1220 including, for example, a keyboard and/or mouse 1222,communication devices 1227 and a storage unit 1228 such as a disk driveor other mass storage device which may include instructions/code anddata 1230, in one embodiment. Further, an audio I/O 1224 may be coupledto the second bus 1220. Note that other architectures are possible. Forexample, instead of the point-to-point architecture of FIG. 12 , asystem may implement a multi-drop bus or other such architecture.

Referring now to FIG. 13 , shown is a block diagram of a second morespecific exemplary system 1300 in accordance with an embodiment of thepresent invention. Like elements in FIGS. 12 and 13 bear like referencenumerals, and certain aspects of FIG. 12 have been omitted from FIG. 13in order to avoid obscuring other aspects of FIG. 13 .

FIG. 13 illustrates that the processors 1270, 1280 may includeintegrated memory and I/O control logic (“CL”) 1272 and 1282,respectively. Thus, the CL 1272, 1282 include integrated memorycontroller units and include I/O control logic. FIG. 13 illustrates thatnot only are the memories 1232, 1234 coupled to the CL 1272, 1282, butalso that I/O devices 1314 are also coupled to the control logic 1272,1282. Legacy I/O devices 1315 are coupled to the chipset 1290.

Referring now to FIG. 14 , shown is a block diagram of a SoC 1400 inaccordance with an embodiment of the present invention. Similar elementsin FIG. 10 bear like reference numerals. Also, dashed lined boxes areoptional features on more advanced SoCs. In FIG. 14 , an interconnectunit(s) 1402 is coupled to: an application processor 1410 which includesa set of one or more cores 1002A-N, which include cache units 1004A-N,and shared cache unit(s) 1006; a system agent unit 1010; a buscontroller unit(s) 1016; an integrated memory controller unit(s) 1014; aset or one or more coprocessors 1420 which may include integratedgraphics logic, an image processor, an audio processor, and a videoprocessor; an static random access memory (SRAM) unit 1430; a directmemory access (DMA) unit 1432; and a display unit 1440 for coupling toone or more external displays. In one embodiment, the coprocessor(s)1420 include a special-purpose processor, such as, for example, anetwork or communication processor, compression engine, GPGPU, ahigh-throughput MIC processor, embedded processor, or the like.

Embodiments of the mechanisms disclosed herein may be implemented inhardware, software, firmware, or a combination of such implementationapproaches. Embodiments of the invention may be implemented as computerprograms or program code executing on programmable systems comprising atleast one processor, a storage system (including volatile andnon-volatile memory and/or storage elements), at least one input device,and at least one output device.

Program code, such as code 1230 illustrated in FIG. 12 , may be appliedto input instructions to perform the functions described herein andgenerate output information. The output information may be applied toone or more output devices, in known fashion. For purposes of thisapplication, a processing system includes any system that has aprocessor, such as, for example; a digital signal processor (DSP), amicrocontroller, an application specific integrated circuit (ASIC), or amicroprocessor.

The program code may be implemented in a high level procedural or objectoriented programming language to communicate with a processing system.The program code may also be implemented in assembly or machinelanguage, if desired. In fact, the mechanisms described herein are notlimited in scope to any particular programming language. In any case,the language may be a compiled or interpreted language.

One or more aspects of at least one embodiment may be implemented byrepresentative instructions stored on a machine-readable medium whichrepresents various logic within the processor, which when read by amachine causes the machine to fabricate logic to perform the techniquesdescribed herein. Such representations, known as “IP cores” may bestored on a tangible, machine readable medium and supplied to variouscustomers or manufacturing facilities to load into the fabricationmachines that actually make the logic or processor.

Such machine-readable storage media may include, without limitation,non-transitory, tangible arrangements of articles manufactured or formedby a machine or device, including storage media such as hard disks, anyother type of disk including floppy disks, optical disks, compact diskread-only memories (CD-ROMs), compact disk rewritables (CD-RWs), andmagneto-optical disks, semiconductor devices such as read-only memories(ROMs), random access memories (RAMs) such as dynamic random accessmemories (DRAMs), static random access memories (SRAMs), erasableprogrammable read-only memories (EPROMs), flash memories, electricallyerasable programmable read-only memories (EEPROMs), phase change memory(PCM), magnetic or optical cards, or any other type of media suitablefor storing electronic instructions.

Accordingly, embodiments of the invention also include non-transitory,tangible machine-readable media containing instructions or containingdesign data, such as Hardware Description Language (HDL), which definesstructures, circuits, apparatuses, processors and/or system featuresdescribed herein. Such embodiments may also be referred to as programproducts.

In an embodiment, an apparatus may include root-table lookup circuitryand context-table lookup circuitry. The root-table lookup circuitry isto find a root-entry in a root table. The root-entry to include acontext pointer to the context table. The context-table lookup circuitryis to find a context entry in a context table. The context entry is toinclude a first nesting bit to indicate whether the entry is for anaddress translation in which a process address space identifier (PASID)is to be used. The context entry to also include at least one of a PASIDpointer to a PASID table and a page-table pointer to a page-tabletranslation structure. The PASID-table pointer is to be used in responsea first nesting-bit indication that the address translation is to use aPASID. The page-table pointer is to be used in response to a secondnesting-bit indication that the address translation is not to use aPASID.

The page-table translation structure may be used to translate forsingle-root I/O virtualization. The page-table translation structure mayalso be used to translate for a virtual function corresponding to aphysical function of an I/O device. The page-table translation structuremay also be used to translate a guest physical address to a hostphysical address. The page-table translation structure may also be usedto translate an I/O virtual address to a host physical address. Theapparatus may also include PASID-table lookup circuitry to find aPASID-entry in the PASID table, the PASID-entry to include a secondnesting bit to indicate whether the entry is to point to a first-leveltranslation structure or a second-level translation structure. Thefirst-level translation structure may be used to translate a guestvirtual address to a guest physical address. The first-level translationstructure may also be used to translate for a virtual functioncorresponding to a physical function of an I/O device. The first-leveltranslation structure may also be used to translate for an assignableinterface of an I/O device. The second-level translation structure maybe used to translate a guest physical address to a host physicaladdress. The second-level translation structure may also be used totranslate for a virtual function corresponding to a physical function ofan I/O device. The second-level translation structure may also be usedto translate for an assignable interface of an I/O device. Thesecond-level translation structure may also be used to translate an I/Ovirtual address to a host physical address. The second-level translationstructure may also be used to translate for a virtual functioncorresponding to a physical function of an I/O device. The second-leveltranslation structure may also be used to translate for an assignableinterface of an I/O device.

In an embodiment, a method may include creating, for a VM by a VMM, avirtual IOMMU corresponding to a physical IOMMU, the virtual IOMMUhaving a PASID entry width that is smaller than the PASID entry width ofthe physical IOMMU; and shadowing, by the VMM, a guest PASID from thevirtual IOMMU in the physical IOMMU. The method may also includestoring, by the VMM, a host PASID in the physical IOMMU, the host PASIDcorresponding to the guest PASID. The guest PASID may be used by avirtual function of a physical function of an I/O device assigned to theVM. The host PASID may be used by an assignable interface of an I/Odevice assigned to the VM.

In an embodiment, an apparatus may include means for performing any ofthe methods described above. In an embodiment, a machine-readabletangible medium may store instructions, which, when executed by amachine, cause the machine to perform any of the methods describedabove.

In an embodiment, a system may include a plurality of physical I/Odevices; a processor to create one or more VMs to which to assign one ormore virtual I/O devices to be abstracted from the plurality of physicalI/O devices; and an IOMMU to perform address translation to supportvirtualization of the plurality of I/O devices according to a pluralityof translation techniques, the IOMMU including context-table lookupcircuitry to find a context entry in a context table, the context entryto include a first nesting bit to indicate whether the entry is for anaddress translation in which a PASID is to be used, the context entry toalso include at least one of a PASID pointer to a PASID table and apage-table pointer to a page-table translation structure, thePASID-table pointer to be used in response a first nesting-bitindication that the address translation is to use a PASID and thepage-table pointer to be used in response to a second nesting-bitindication that the address translation is not to use a PASID.

The IOMMU may also include root-table lookup circuitry to find aroot-entry in a root table, the root-entry to include a context pointerto the context table. The page-table translation structure may be usedto translate for single-root I/O virtualization. The page-tabletranslation structure may also be used to translate for a virtualfunction corresponding to a physical function of an I/O device. Thepage-table translation structure may also be used to translate a guestphysical address to a host physical address. The page-table translationstructure may also be used to translate an I/O virtual address to a hostphysical address. The IOMMU may also include PASID-table lookupcircuitry to find a PASID-entry in the PASID table, the PASID-entry toinclude a second nesting bit to indicate whether the entry is to pointto a first-level translation structure or a second-level translationstructure. The first-level translation structure may be used totranslate a guest virtual address to a guest physical address. Thefirst-level translation structure may also be used to translate for avirtual function corresponding to a physical function of an I/O device.The first-level translation structure may also be used to translate foran assignable interface of an I/O device. The second-level translationstructure may be used to translate a guest physical address to a hostphysical address. The second-level translation structure may also beused to translate for a virtual function corresponding to a physicalfunction of an I/O device. The second-level translation structure mayalso be used to translate for an assignable interface of an I/O device.The second-level translation structure may also be used to translate anI/O virtual address to a host physical address. The second-leveltranslation structure may also be used to translate for a virtualfunction corresponding to a physical function of an I/O device. Thesecond-level translation structure may also be used to translate for anassignable interface of an I/O device.

In an embodiment, a PASID entry may be extended to include asecond-level table pointer (when a first-level table pointer is alreadythere) that can be used to do GPA-to-HPA or IOVA-to-HPA translations. Inan embodiment, a PASID entry may include a translation-type field toindicate whether the translation is first-level only, second-level onlyand a nesting bit to indicate if it is a nested translation. In anembodiment, a context entry may be extended to include an RID2PASIDfield, and the second level table pointer may be removed from thecontext entry. The RID2PASID field may contain a PASID that may indicatewhich PASID to use to index into the system-wide PASID table forrequests-without-PASID. In an embodiment, the PASID entry may beextended to include another second-level table pointer for doingGIOVA-to-GPA translations, which may be used to do nested IOVAtranslations (GIOVA-to-GPA-to-HPA) for requests with a PASID. Inembodiments, the context entry may be extended to include anothersecond-level table pointer for doing IOVA-to-GPA translations which maybe used to do nested IOVA translations (GIOVA-to-GPA-to-HPA) forrequests-without-PASID. In embodiments, the VMM may create a separatePASID table per VM to support SVM operations for assigned VFs/PFs. In anembodiment, the VMM may create a single system-wide host PASID table (ora per-IOMMU PASID table but maintain a single host PASID space). In anembodiment, the VM's PASID table is pointed to by the context entry ofVFs/PFs assigned to the VM, whereas the system-wide host PASID table ispointed to by the context entry of AIs and other VFs/PFs assigned to theVMM. In an embodiment, the VMM can expose one of the two types ofvirtual IOMMUs to the VM: a virtual IOMMU that allocates and manages itsown guest PASID space and PASID table (for example, a fully emulatedIntel IOMMU); and a para-virtualized IOMMU which doesn't maintain itsown guest PASID space or PASID table but instead uses VMM services(hypercalls) to get system-wide host PASIDs from the host IOMMU driver.For vIOMMUs of the first type, the VMM shadows the guest PASID tableinto the VM's physical PASID table, exposes a PASID width which issmaller than the physical PASID width, and configures the guest PASIDsfrom the guest PASID table into the VM's shadow PASID table. The VMMalso configures the host PASID corresponding to the guest PASID into theshadow PASID table to support VFs/PFs that do SVM using EMQCMD andENQCMDS instructions. For vIOMMUs of the second type, the VMM configuressystem-wide host PASIDs allocated for the VM in the VM's PASID table tosupport both ENQCMD/S and non-ENQCMD/S based SVM.

What is claimed is:
 1. An apparatus comprising: first circuitry to useat least an identifier of a device to locate a context entry, thecontext entry to include at least one of a page-table pointer to apage-table translation structure and a process address space identifier(PASID); and second circuitry to use at least the PASID to locate aPASID-entry, the PASID-entry to include at least one of a first-levelpage-table pointer to a first-level translation structure and asecond-level page-table pointer to a second-level translation structure;wherein the PASID is to be supplied by the device; and wherein at leastone of the apparatus, the context entry, and the PASID entry is toinclude one or more control fields to indicate whether the first-levelpage-table pointer or the second-level page-table pointer is to be used.2. The apparatus of claim 1, wherein the second-level translationstructure of a PASID-entry is to be used to translate a guest physicaladdress or an I/O virtual address to a host physical address for anaddress translation in which a PASID is provided.
 3. The apparatus ofclaim 1, wherein the control fields in the PASID-entry indicate whethera nested translation is to be performed using the first-level page-tablepointer and one of the page-table pointer in the context entry and thesecond-level page-table pointer in the PASID entry.
 4. The apparatus ofclaim 2, wherein the PASID-entry is also to include an additionalsecond-level pointer to a second-level translation table to be used totranslate a guest I/O virtual address to a guest physical address for anaddress translation in which a PASID is provided.
 5. The apparatus ofclaim 2, wherein the context entry is also to include an additionalsecond-level pointer to a second-level translation table to be used totranslate a guest I/O virtual address to a guest physical address for anaddress translation in which a PASID is not provided.
 6. The apparatusof claim 1, wherein the PASID table is one of a plurality of PASIDtables, each of the plurality of PASID tables to be created by a virtualmachine monitor (VMM) to support shared virtual memory (SVM) operationsfor a virtual function (VF) or a physical function (PF).
 7. Theapparatus of claim 6, wherein the VMM is to maintain a singlesystem-wide host PASID space.
 8. The apparatus of claim 7, wherein thecontext entry is associated with a VF or PF assigned to a virtualmachine (VM) and the PASID table is associated with the VM.
 9. Theapparatus of claim 7, wherein the context entry is associated with aplurality of assignable interfaces and VF or PF assigned to the VMM andthe PASID table is the single system-wide host PASID table.
 10. Theapparatus of claim 8, wherein the VMM is to expose a virtual I/O memorymanagement unit (IOMMU) to the VM, the virtual IOMMU to allocate andmanage its own guest PASID space.
 11. The apparatus of claim 8, whereinthe VMM is to expose a virtual I/O memory management unit (IOMMU) to theVM, the virtual IOMMU to use system-wide host PASIDs, provided by theVMM, from a host IOMMU driver.
 12. The apparatus of claim 10, whereinthe VMM is also to shadow a guest PASID table for the VM in a physicalPASID table.
 13. The apparatus of claim 12, wherein the VMM is also toconfigure a host PASID corresponding to a guest PASID in a shadow PASIDtable to support SVM operations with enqueuing instructions.
 14. Theapparatus of claim 11, wherein the VMM is also to allocate a privatePASID table to the VM and to allocate and configure system-wide hostPASIDs for the VM in the private PASID table to support SVM operationswith and without enqueuing instructions.
 15. The apparatus of claim 1,wherein the PASID, if not supplied by the device, is to be configured inthe context entry for the IOMMU to use for address translation insteadof the context entry's translation structures.
 16. A method comprising:creating, for a virtual machine (VM) by a virtual machine monitor (VMM),a virtual input/output memory management unit (IOMMU) corresponding to aphysical IOMMU, the virtual IOMMU having a process address spaceidentifier (PASID) entry width that is smaller than the PASID entrywidth of the physical IOMMU; and shadowing, by the VMM, a guest PASIDfrom the virtual IOMMU in the physical IOMMU.
 17. The method of claim16, further comprising configuring, by the VMM, a host PASID in thephysical IOMMU PASID table, the host PASID corresponding to the guestPASID.
 18. The method of claim 17, wherein the guest PASID is to be usedby a virtual function or a physical function of an input/output deviceassigned to the VM.
 19. The method of claim 17, wherein the host PASIDis to be used by an assignable interface (AI) of an input/output deviceassigned to the VM.
 20. A system comprising: a plurality of physicalinput/output (I/O) devices; a processor to create one or more virtualmachines (VMs) to which to assign one or more virtual I/O devices to beabstracted from the plurality of physical I/O devices; an I/O memorymanagement unit (IOMMU) to perform address translation to supportvirtualization of the plurality of I/O devices according to a pluralityof translation techniques, the IOMMU including: first circuitry to useat least an identifier of a device to locate a context entry, thecontext entry to include at least one of a page-table pointer to apage-table translation structure and a process address space identifier(PASID); and second circuitry to use at least the PASID to locate aPASID-entry, the PASID-entry to include at least one of a first-levelpage-table pointer to a first-level translation structure and asecond-level page-table pointer to a second-level translation structure;wherein the PASID is to be supplied by the device; and wherein at leastone of the apparatus, the context entry, and the PASID entry is toinclude one or more control fields to indicate whether the first-levelpage-table pointer or the second-level page-table pointer is to be used.